import { createRouter,createWebHashHistory} from 'vue-router'

const routes = [
  {	
    path: '/',  //login,默认加载login路由
    redirect: '/admin' 
  },
  // {
  //   path: '/login',
  //   name: 'login',
  //   component: () => import('@/views/login/index.vue')
  // },
  ///////////布局路由(右边菜单导航,就是admin/index.vue(类似iframe)的显示的路由页面)  ///////////
  {
    path: '/admin', //布局页，就是登录完成后调整到这个页
    name: 'admin',
    component: () => import('@/views/admin/index.vue'),
    children:[ //子路由(子组件页面)
      // {
      //   path: '',  //默认子路由路径为空字符串,即启动时,子路由默认显示页面
      //   redirect: 'welcome'  // 重定向到默认的子路由
      // },
      {
        path: '/welcome', //首页
        name: 'welcome',
        component: () => import('@/views/admin/welcome/index.vue')
      },
      {
        path: '/test', //测试
        name: 'test',
        component: () => import('@/views/admin/test/index.vue')
      },
      {
        path: '/files', //我的数据
        name: 'files',
        component: () => import('@/views/admin/files/index.vue')
      },      
      {
        path: '/terminal', //终端管理
        name: 'terminal',
        component: () => import('@/views/admin/terminal/index.vue')
      },
      {
        path: '/transfer', //传输
        name: 'transfer',
        component: () => import('@/views/admin/transfer/index.vue'),
      },
    ]
  }
]

const router = createRouter({
  //history: createWebHistory(process.env.BASE_URL), //web路由模式
  //history: createWebHashHistory(), //hash路由模式,electron打包必须先用hash路由模式
  //history: process.env.IS_ELECTRON ? createWebHashHistory() : createWebHistory(),routes
  history:  createWebHashHistory(),routes
})

export default router
